import {takeEvery, call,put,} from 'redux-saga/effects'
import { get } from '@u/http'
import { loadDataSync } from './actionCreator'

function * loadaDataASync(){
    let result = yield call(get,{ url:'api/checklist'})
    yield put(loadDataSync(result.data.check_list))   // put ==>抛发 dispatch
}

function * loadData(){
    yield takeEvery( 'loadDataSaga' , loadaDataASync)   //父组件 diaptch (typr:loadDataSaga)
}

export default loadData

